from app.dao.base import BaseDao

from app.schema.file import *
from app.model.file import File
class FileDao(BaseDao):
    Model = File
    pass

    def read_by_user_id(self, user_id: str) -> File:
        return self.db.sess.query(File).filter(
            File.user_id == user_id,
            File.is_deleted == 0,
            File.status != 2
        ).all()
    
    def read_by_ai_id(self, ai_id: str) -> File:
        return self.db.sess.query(File).filter(
            File.ai_id == ai_id,
            File.is_deleted == 0,
            File.status != 2
        ).all()